package com.xxtx.trade.sysUser.mapper;


import com.xxtx.trade.agent.bean.TradeSysAgent;
import com.xxtx.trade.sysUser.bean.TradeSysUser;
import com.xxtx.trade.sysUser.dto.TradeSysRoleDto;
import com.xxtx.trade.sysUser.dto.TradeSysUserDto;
import com.xxtx.trade.sysUser.vo.TradeSysUserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface TradeSysUserMapper {
    int deleteByPrimaryKey(String id);

    int insert(TradeSysUser record);

    int insertSelective(TradeSysUser record);

    TradeSysUser selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(TradeSysUser record);

    int updateByPrimaryKey(TradeSysUser record);

    /**
     * 根据账号查询 登录信息
     * @param accountName
     * @return
     */
    TradeSysUser selectUserByAccount(String accountName);

    /**
     * 重置密码
     */
    void updateSysPassword(TradeSysUserDto dto);

    List<TradeSysUserVo> selectByQuestList(TradeSysUserDto dto);

    void updateUserState(@Param("id") String id, @Param("state") int state);

    /**
     *  用户自己更改密码
     * @param dto
     */
    void updateUSerPassword(TradeSysUserDto dto);

    /**
     * 代理商查看自己创建的账号
     * @param dto
     * @return
     */
    List<TradeSysUserVo> selectAgentUserList(TradeSysUserDto dto);

    /**
     *  查看账户列表
     * @param dto
     * @return
     */
    List<TradeSysUserVo> selectAccountList(TradeSysUserDto dto);

    void updateAgentName(@Param("id") String id, @Param("nickName") String nickName);


    TradeSysUser selectUserByAccountId(String id);


    // wzyk新增: 根据用户id在agent表中查询agent_id
    String selectAgentId(TradeSysRoleDto dto);

    String selectAgentIdByAccountId(String userId);

    //获取用户角色，用于权限控制，之前是用了用户的id，错误的。
    String selectRoleByUserId(String user_id);

    // 从aa_douying_url中获取所有的链接
    List<Map<String, Object>> selectAllUrls();

    void deleteExpiredInfo();
    void deleteExpiredTencetInfo();

    void deleteUrl(TradeSysRoleDto tradeSysRoleDto);

    TradeSysUserDto selectDeleteInfo(TradeSysUserDto dto);

    void deleteAgent(TradeSysUserDto dto1);

    void deleteUser(TradeSysUserDto dto1);
}